This sample code shows the use of the DeactivatePrintWindow Event (Window Object). Modify the following sample code to fit your needs.
Dim rpt As CRPEAuto.Report
Dim rptView As CRPEAuto.View
Dim test As Integer
Private Sub DeactivatePrintWindow_Click()
'Starts up report window for window event DeactivatePrintWindow
On Error GoTo ErrorHandler
Set rpt = crsApp.OpenReport("c:\crw\reports\xtreme\www.sales.rpt")
test = MsgBox("Event default: Enabled = " & _
rpt.EventInfo.ActivatePrintWindowEventEnabled & _
Chr(13) & Chr(13) & "Disable event?", vbYesNo)
If test = vbYes Then
rpt.EventInfo.ActivatePrintWindowEventEnabled = False
MsgBox "Check event does not occur when print window deactivated"
Else
rpt.EventInfo.ActivatePrintWindowEventEnabled = True
MsgBox "Check event occurs when print window deactivated. Switch between this form and report window and window should be activated/ deactivated"
End If
Set rptView = rpt.Preview
Set windowEvs = rptView.Parent
WinText.Visible = True
Exit Sub ' Exit to avoid handler.
Private Sub windowEvs_DeactivatePrintWindow()
'executed when window is deactivated(loses focus)
dcount = dcount + 1
WinText.Text = "Window DeactivatePrintWindow event. " & "Count: " & dcount
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |